﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ERP_SaaS_WinForm.登录.Common
{
    public class TokenDto
    {
        private static string _jwtToken = string.Empty;
        private static string _name = string.Empty;
        private static string _password = string.Empty;

        public static string JwtToken 
        { 
            get => _jwtToken;
            set => _jwtToken = value ?? string.Empty;
        }
        
        public static string Name 
        { 
            get => _name;
            set => _name = value ?? string.Empty;
        }
        
        public static string Password 
        { 
            get => _password;
            set => _password = value ?? string.Empty;
        }

        /// <summary>
        /// 清理所有敏感信息
        /// </summary>
        public static void Clear()
        {
            _jwtToken = string.Empty;
            _name = string.Empty;
            _password = string.Empty;
        }

        /// <summary>
        /// 检查是否已登录
        /// </summary>
        public static bool IsLoggedIn => !string.IsNullOrEmpty(_jwtToken);
    }
}
